#   *
#  ***
# *****
#  ***
#   *

num = 3
# for i in range(1, 3 + 1):  # (start,end,step-间隔)
#     # 循环空格
#     for j in range(3 - 1, 0, -1):
#         print(" ", end='')
#     # 循环*号
#     for k in range(1, 2 * 3, 2):
#         print("*", end='')
#     print()

row = 7

# 菱形
for i in range(1, ((row - 1) // 2 + 1) * 2, 2):
    print(("*" * i).center(row))
for i in range(((row - 1) // 2) * 2 - 1, 0, -2):
    print(("*" * i).center(row))

# row = int(input("请输入行数："))
# if row % 2 == 0:
#     rows = row // 2
# else:
#     rows = row // 2 + 1
# # 打印上半部分
# for i in range(1, rows + 1):
#     print(' ' * (rows - i) + '*' * (2 * i - 1))
# # 打印下半部分
# for j in range(row // 2, 0, -1):
#     # print(" ",end=" ")
#     print(' ' * (rows - j) + '*' * (2 * j - 1))
# 打印菱形
row = 9
for i in range(1,row//2+2):
    print(' '*(row//2+2-i)+'*'*(2*i-1))
for j in range(row//2,0,-1):
    print(' '*(row//2+2-j)+'*'*(2*j-1))



# 打印水仙花树
a = 0
b = 0
c = 0
for i in range(100, 999):
    a = i // 100
    b = (i // 10) % 10
    c = i % 10
    if a * a * a + b * b * b + c * c * c == i:
        print(i, end=' ')
print('')

# 打印九九乘法表
for i in range(1,10):
    for j in range(1,i+1):
        print("{}*{}={:2}".format(j,i,i*j),end=' ')
    print('')

# for i in range(1.10):
#     for j in range(1,i+1):
#         print("{}*{}={:2}".format(j,i,i*j),end=' ')

# 完数
a = 0
b = 0
for a in range(1,1000):
    sum = 0
    for b in range(1,a-1):
        if a%b==0:
            sum+=b
    if sum==a:
        print("完数",a,"因子",end=' ')
        for b in range(1,a):
            if a%b ==0:
                print(b,end=' ')
print('')

# a=0
# b=0
# for a in range (1,100):
#     sum = 0
#     for b in range (1,a-1):
#         if a%b==0:
#             sum +=b
#     if sum ==a :
#         print("完数", a, "因子", end=' ')
#         for b in range(1,a):
#             if a%b ==0:
#                 print(b,end=' ')
# print('')

# 质数
for i in range(1,100):
    sum = 1
    for j in range(2,i):
        if i%j==0:
            sum =0
            break
    if sum == 1:
        print(i,end=' ')
print('')

# 斐波那契数列
def fib(n):
    if (n == 1) or (n == 2):
        return 1
    return fib(n - 1) + fib(n - 2)
print(fib(10))
print('')

print("aaaaaa")
# 斐波那契数列：1，1，2，3，5，8，13，21.。。

a=1
b=1
for i in range(1, 10):
    if i == 1:
        print(1)
    elif i == 2:
        print(1)
    else:
        print(a + b)
        a, b = b, a + b

# 斐波那契数列
